cc.Class({
    extends: cc.Component,

    properties: {
        angle:0.0,
        velocity:0.0,
    },

    onLoad: function () {
        this.angle=Math.random()*cc.macro.PI*2;   
    },

    update: function (dt) {
        let a=this.angle;
        let x=Math.cos(a);
        let y=Math.sin(a);
        let s=cc.v2(x,y).mul(this.velocity*dt).add(this.node.position);
        this.node.position=s;
        let size=Global.vsize;
        let rect=cc.rect(-size.width/2,-size.height/2,size.width,size.height);
        let pos=this.node.position;
        if(!rect.contains(pos)){
            this.node.removeFromParent();
        }
    },
});
